package com.fast.develop.meta.dm.factory;

import com.fast.develop.meta.dm.builder.MetaFieldBuilder;
import com.fast.develop.meta.dm.value.ValueGeneration;
import com.fast.develop.meta.dm.value.generator.ConstantValueGenerator;
import com.fast.develop.meta.dm.value.generator.ElValueGenerator;
import com.fast.develop.meta.dm.value.generator.SequenceValueGenerator;
import org.json.JSONObject;

/**
 * @author 莫寅
 * @createTime 2022-06-04 15:58
 * @desc：
 */
public class ValueGenerationFactory {

    public static ValueGeneration create(String type, JSONObject rawSchema, MetaFieldBuilder metaFieldBuilder){
        ValueGeneration valueGeneration = null;
        String value = rawSchema.optString("value", null);
        switch (type){
            case "constant":
                valueGeneration = new ConstantValueGenerator(value);
                break;
            case "el":
                valueGeneration = new ElValueGenerator(value);
                break;
            case "sequence":
                valueGeneration = new SequenceValueGenerator(value);
                break;

        }

        return valueGeneration;
    }
}
